package com.example.carbon.pojo.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 作为一个vo的返回类
 * @param <T>
 */
@Data
@AllArgsConstructor
public class RestBean<T> {
    /**
     * 返回是否处理成功
     */
    private boolean success;
    /**
     * 返回状态码
     */
    private int code;
    /**
     * 返回信息
     */
    private T message;
    public static<T> RestBean success(T message){
        return new RestBean(true,200,message);
    }
    public static<T>  RestBean success(){
        return new RestBean(true,200,"success");
    }
    public static<T>  RestBean failure(int code,T message){
        return new RestBean(false,code,message);
    }
    public static<T>  RestBean failure(T message){
        return new RestBean(false,500,message);
    }
}
